#!/bin/bash
# linux下安装thmar(esp32)依赖库
# author guyadong
# date 2024/08/23

sh_folder=$(cd "$(dirname $0)"; pwd -P)

machine=xtensa-esp32-elf

CC=xtensa-esp32-elf-gcc
[ -n "$CROSS_COMPILER_PREFIX" ] && CC=$CROSS_COMPILER_PREFIX/bin/$CC

[ ! $($CC -dumpmachine) ] \
    && echo "not install compiler xtensa-esp32-elf-gcc,install please" \
    && exit 255

if ! which cmake 2>/dev/null 
then
    echo cmake NOT FOUND. && exit 255 
fi
if ! which conan 2>/dev/null 
then 
    echo conan NOT FOUND. && exit 255
fi
if  ! python --version 2>/dev/null | grep "Python 3." 
then
    echo Python 3 required. && exit 255
fi

conan install $sh_folder -of $sh_folder/build/$machine -pr:h $sh_folder/conan2/profiles/esp32_gcc -pr:b default \
    -o build_test=False -o with_paho=False \
    --build missing
	
#  -pr:h esp32_gcc 指定目标平台的profile
#  -pr:b default  指定编译平台的profile
# --build missing 编译缺少的依赖库

